package l1j.server.server.command.executor;
import l1j.server.server.model.Instance.L1PcInstance;
import l1j.server.server.serverpackets.S_SystemMessage;

public class L1ChatOnOff implements L1CommandExecutor {
	public static L1CommandExecutor getInstance() {
		return new L1ChatOnOff();
	}
	private L1ChatOnOff() {
	}
	// @Override
	@Override
	public void execute(L1PcInstance pc, String cmdName, String arg) {
		if (arg.equalsIgnoreCase("全部")) {
			if(pc.isAllClose()){
				pc.allopen();
				pc.sendPackets(new S_SystemMessage("【開啟】全部頻道竊聽。"));
			}else{
				pc.allclose();
				pc.sendPackets(new S_SystemMessage("【關閉】全部頻道竊聽。"));
			}
		} else if (arg.equalsIgnoreCase("密語")) {
			if(pc.isOverHead()){
				pc.setOverHead(false);
				pc.sendPackets(new S_SystemMessage("【關閉】密語頻道竊聽。"));
			}else{
				pc.setOverHead(true);
				pc.sendPackets(new S_SystemMessage("【開啟】密語頻道竊聽。"));
			}
		}else if(arg.equalsIgnoreCase("一般")){
			if(pc.isOverHead0()){
				pc.setOverHead0(false);
				pc.sendPackets(new S_SystemMessage("【關閉】一般頻道竊聽。"));
			}else{
				pc.setOverHead0(true);
				pc.sendPackets(new S_SystemMessage("【開啟】一般頻道竊聽。"));
			}
			}else if(arg.equalsIgnoreCase("血盟")){
				if(pc.isOverHead4()){
					pc.setOverHead4(false);
					pc.sendPackets(new S_SystemMessage("【關閉】血盟頻道竊聽。"));
				}else{
					pc.setOverHead4(true);
					pc.sendPackets(new S_SystemMessage("【開啟】血盟頻道竊聽。"));
				}
			}else if(arg.equalsIgnoreCase("組隊")){
				if(pc.isOverHead11()){
					pc.setOverHead11(false);
					pc.sendPackets(new S_SystemMessage("【關閉】組隊頻道竊聽。"));
				}else{
					pc.setOverHead11(true);
					pc.sendPackets(new S_SystemMessage("【開啟】組隊頻道竊聽。"));
				}
			}else if(arg.equalsIgnoreCase("聯盟")){
				if(pc.isOverHead13()){
					pc.setOverHead13(false);
					pc.sendPackets(new S_SystemMessage("【關閉】聯盟頻道竊聽。"));
				}else{
					pc.setOverHead13(true);
					pc.sendPackets(new S_SystemMessage("【開啟】聯盟頻道竊聽。"));
				}
			}else if(arg.equalsIgnoreCase("上線玩家")){
				if(pc.isOverHeadXX()){
					pc.setOverHeadXX(false);
					pc.sendPackets(new S_SystemMessage("【關閉】上線玩家通知。"));
				}else{
					pc.setOverHeadXX(true);
					pc.sendPackets(new S_SystemMessage("【開啟】上線玩家通知。"));
				}
		} else {
			pc.sendPackets(new S_SystemMessage("請輸入: ."+cmdName + " 全部、密語、一般、血盟、組隊、聯盟、上線玩家 。"));
		}
	}

}
